import type { BuiltInGlobalTheme } from 'naive-ui/es/themes/interface'
import useThemeStore from '@/stores/theme'
import { lightTheme, darkTheme } from 'naive-ui'
import storage from './storage'
const ThemeUtils = {
    themeList: ['light', 'dark'],
    getThemeLabel: () => {
        const theme = useThemeStore()
        return theme.getThemeLabel()
    },
    setTheme: (label: string) => {
        const themeList = ['light', 'dark']
        if (themeList.indexOf(label) > -1) {
            storage.set('theme', label)
            const theme = useThemeStore()
            theme.setTheme(label)
        }
    },
    getTheme: () => {
        const theme = useThemeStore()
        switch (theme.getThemeLabel()) {
            case 'light':
                return lightTheme
                break
            case 'dark':
                return darkTheme
                break;
            default:
                throw Error("theme doesn't exist!")
                break
        }
    }

}
export default ThemeUtils;